﻿using ConfExpert.Forms.Base;
using DevExpress.XtraEditors.Repository;
using DevTeam;

using System;
namespace ConfExpert.Forms.Planlama
{
    public partial class KesilenYuklenen : XForm
    {
        public KesilenYuklenen()
        {
            InitializeComponent();
        }

        private void KesilenYuklenen_Load(object sender, EventArgs e)
        {
            
            gridView1.Init("GetKesilenYuklenen", beiYil.EditValue.ToDate().Year); //DateTime.Now.Year.ToString().Substring(2, 2));
            gridView1.FormatAsNumber(0, "Kesilen", "Yuklenen", "Kalan");
            gridView1.AddSummary("Kesilen", "Yuklenen", "Kalan");
            gridView1.BestFitColumns();


            beiYil.EditValueChanged += Edit_EditValueChanged;
            beiYil.EditValue = DateTime.Today.AddYears(-1);
            ((RepositoryItemDateEdit)beiYil.Edit).CalendarView = CalendarView.TouchUI;
            ((RepositoryItemDateEdit)beiYil.Edit).Mask.EditMask = "yyyy";   // "MM/yyyy"; //dd
            ((RepositoryItemDateEdit)beiYil.Edit).Mask.UseMaskAsDisplayFormat = true;

        }

        
        void Edit_EditValueChanged(object sender, EventArgs e)
        {
            gridView1.RefreshDataSource(true, "GetKesilenYuklenen", beiYil.EditValue.ToDate().Year);
            gridView1.BestFitColumns();
        }
    }
}
